package com.kgame5.xtank3d.app.view.gbook.pageloading {
import com.kgame5.xtank3d.app.AppEnum;

import org.puremvc.as3.interfaces.INotification;
import org.puremvc.as3.patterns.mediator.Mediator;

import flash.events.Event;

/**
 * @author kangkai
 */
public class PageLoadingMediator extends Mediator{
	public static const NAME:String="PageLoadingMediator";
	
	private var comp:PageLoadingComp;
	
	public function PageLoadingMediator(p_comp:PageLoadingComp){
		super(NAME);
		
		comp=p_comp;
		comp.addEventListener(Event.COMPLETE, onOK);
		
	}

	public override function listNotificationInterests() : Array {
		return [
			
		];
	}

	public override function handleNotification(e : INotification) : void {
		
	}
	
	//--comp的事件
	private function onOK(e:Event):void{
		trace("加载完毕，切换到新页面");
		this.sendNotification(AppEnum.TURN_PAGE,AppEnum.PAGEID_PLAY);
	
		//TODO 
		trace("注意，这里是临时的命令启动游戏，正式的应该是放到ready go 之后");
		this.sendNotification(AppEnum.START_GAME_ENGINE);
	}
}//end of class
}
